<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
  Class: Option
  
    &mdash; Documentation by YARD 0.7.3
  
</title>

  <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />

  <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  relpath = '';
  if (relpath != '') relpath += '/';
</script>

  <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="js/app.js"></script>


  </head>
  <body>
    <script type="text/javascript" charset="utf-8">
      if (window.top.frames.main) document.body.className = 'frames';
    </script>
    
    <div id="header">
      <div id="menu">
  
    <a href="_index.html">Index (O)</a> &raquo; 
    
    
    <span class="title">Option</span>
  
  
  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">
  
    <a id="class_list_link" href="#">Class List</a>
  
    <a id="method_list_link" href="#">Method List</a>
  
    <a id="file_list_link" href="#">File List</a>
  
</div>
      <div class="clear"></div>
    </div>
    
    <iframe id="search_frame"></iframe>
    
    <div id="content"><h1>Class: Option
  
  
  
</h1>

<dl class="box">
  
    <dt class="r1">Inherits:</dt>
    <dd class="r1">
      <span class="inheritName">ActiveRecord::Base</span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next">ActiveRecord::Base</li>
          
            <li class="next">Option</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
      </dd>
    
  
  
    
  
    
      <dt class="r2">Includes:</dt>
      <dd class="r2"><span class='object_link'><a href="Translatable.html" title="Translatable (module)">Translatable</a></span></dd>
      
    
  
  
  
    <dt class="r1 last">Defined in:</dt>
    <dd class="r1 last">app/models/option.rb</dd>
  
</dl>
<div class="clear"></div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    <p>
ELMO - Secure, robust, and versatile data collection. Copyright 2011 The
Carter Center
</p>
<p>
ELMO is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
</p>
<p>
ELMO is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details.
</p>
<p>
You should have received a copy of the GNU General Public License along
with ELMO. If not, see &lt;http://www.gnu.org/licenses/&gt;.
</p>


  </div>
</div>
<div class="tags">
  

</div>

  
  
  
  
  


  
  
  
  

  
    <h2>
      Class Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#default_eager-class_method" title="default_eager (class method)">+ (Object) <strong>default_eager</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#per_page-class_method" title="per_page (class method)">+ (Object) <strong>per_page</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#sorted-class_method" title="sorted (class method)">+ (Object) <strong>sorted</strong>(params = {}) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
    </ul>
  
    <h2>
      Instance Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#english_name-instance_method" title="#english_name (instance method)">- (Object) <strong>english_name</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>
hack so the validation message will look right.
</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#is_translation_method%3F-instance_method" title="#is_translation_method? (instance method)">- (Boolean) <strong>is_translation_method?</strong>(symbol) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#method_missing-instance_method" title="#method_missing (instance method)">- (Object) <strong>method_missing</strong>(*args) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#name-instance_method" title="#name (instance method)">- (Object) <strong>name</strong>(lang = nil) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#name%3D-instance_method" title="#name= (instance method)">- (Object) <strong>name=</strong>(lang, value) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#published%3F-instance_method" title="#published? (instance method)">- (Boolean) <strong>published?</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#questions-instance_method" title="#questions (instance method)">- (Object) <strong>questions</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#respond_to%3F-instance_method" title="#respond_to? (instance method)">- (Boolean) <strong>respond_to?</strong>(symbol, *) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#respond_to_missing%3F-instance_method" title="#respond_to_missing? (instance method)">- (Boolean) <strong>respond_to_missing?</strong>(symbol, include_private) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
    </ul>
  


  
  
  
  
  
  
  
  <h3 class="inherited">Methods included from <span class='object_link'><a href="Translatable.html" title="Translatable (module)">Translatable</a></span></h3>
  <p class="inherited"><span class='object_link'><a href="Translatable.html#set_translation_for-instance_method" title="Translatable#set_translation_for (method)">#set_translation_for</a></span>, <span class='object_link'><a href="Translatable.html#translation_for-instance_method" title="Translatable#translation_for (method)">#translation_for</a></span>, <span class='object_link'><a href="Translatable.html#translation_hash-instance_method" title="Translatable#translation_hash (method)">#translation_hash</a></span>, <span class='object_link'><a href="Translatable.html#translation_obj_for-instance_method" title="Translatable#translation_obj_for (method)">#translation_obj_for</a></span></p>

  <div id="method_missing_details" class="method_details_list">
  <h2>Dynamic Method Handling</h2>
  <p class="notice this">
    This class handles dynamic methods through the <tt>method_missing</tt> method
    
  </p>
  
    <div class="method_details first">
  <p class="signature first" id="method_missing-instance_method">
  
    - (<tt>Object</tt>) <strong>method_missing</strong>(*args) 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


45
46
47
48
49
50
51
52</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/option.rb', line 45</span>

<span class='def def kw'>def</span> <span class='method_missing identifier id'>method_missing</span><span class='lparen token'>(</span><span class='mult op'>*</span><span class='args identifier id'>args</span><span class='rparen token'>)</span>
  <span class='comment val'># enable methods like name_fra and hint_eng, etc.</span>
  <span class='if if kw'>if</span> <span class='args identifier id'>args</span><span class='lbrack token'>[</span><span class='integer val'>0</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='to_s identifier id'>to_s</span><span class='dot token'>.</span><span class='match identifier id'>match</span><span class='lparen token'>(</span><span class='regexp val'>/^(name)_([a-z]{3})(_before_type_cast)?(=?)$/</span><span class='rparen token'>)</span>
    <span class='send identifier id'>send</span><span class='lparen token'>(</span><span class='dstring node'>&quot;#{$1}#{$4}&quot;</span><span class='comma token'>,</span> <span class='Language constant id'>Language</span><span class='dot token'>.</span><span class='by_code identifier id'>by_code</span><span class='lparen token'>(</span><span class='$2 nth_ref id'>$2</span><span class='rparen token'>)</span><span class='comma token'>,</span> <span class='mult op'>*</span><span class='args identifier id'>args</span><span class='lbrack token'>[</span><span class='float val'>1</span><span class='dot2 op'>..</span><span class='integer val'>2</span><span class='rbrack token'>]</span><span class='rparen token'>)</span>
  <span class='else else kw'>else</span>
    <span class='super super kw'>super</span>
  <span class='end end kw'>end</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
  
</div>


  <div id="class_method_details" class="method_details_list">
    <h2>Class Method Details</h2>
    
    
      <div class="method_details first">
  <p class="signature first" id="default_eager-class_method">
  
    + (<tt>Object</tt>) <strong>default_eager</strong> 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


43</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/option.rb', line 43</span>

<span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='default_eager identifier id'>default_eager</span><span class='semicolon token'>;</span> <span class='lbrack token'>[</span><span class='symbol val'>:translations</span><span class='comma token'>,</span> <span class='lbrace token'>{</span><span class='symbol val'>:option_sets</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='lbrack token'>[</span><span class='symbol val'>:questionings</span><span class='comma token'>,</span> <span class='lbrace token'>{</span><span class='symbol val'>:questions</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='lbrace token'>{</span><span class='symbol val'>:questionings</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='symbol val'>:form</span><span class='rbrace token'>}</span><span class='rbrace token'>}</span><span class='rbrack token'>]</span><span class='rbrace token'>}</span><span class='rbrack token'>]</span> <span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="per_page-class_method">
  
    + (<tt>Object</tt>) <strong>per_page</strong> 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


41</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/option.rb', line 41</span>

<span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='per_page identifier id'>per_page</span><span class='semicolon token'>;</span> <span class='integer val'>100</span> <span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="sorted-class_method">
  
    + (<tt>Object</tt>) <strong>sorted</strong>(params = {}) 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


37
38
39</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/option.rb', line 37</span>

<span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='sorted identifier id'>sorted</span><span class='lparen token'>(</span><span class='params identifier id'>params</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span><span class='rparen token'>)</span>
  <span class='paginate identifier id'>paginate</span><span class='lparen token'>(</span><span class='symbol val'>:all</span><span class='comma token'>,</span> <span class='params identifier id'>params</span><span class='rparen token'>)</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>
    
    
      <div class="method_details first">
  <p class="signature first" id="english_name-instance_method">
  
    - (<tt>Object</tt>) <strong>english_name</strong> 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>
hack so the validation message will look right
</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


65</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/option.rb', line 65</span>

<span class='def def kw'>def</span> <span class='english_name identifier id'>english_name</span><span class='semicolon token'>;</span> <span class='name_eng identifier id'>name_eng</span> <span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="is_translation_method?-instance_method">
  
    - (<tt>Boolean</tt>) <strong>is_translation_method?</strong>(symbol) 
  

  
</p><div class="docstring">
  <div class="discussion">
    

  </div>
</div>
<div class="tags">
  
<h3>Returns:</h3>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Boolean</tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


60
61
62</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/option.rb', line 60</span>

<span class='def def kw'>def</span> <span class='is_translation_method? fid id'>is_translation_method?</span><span class='lparen token'>(</span><span class='symbol identifier id'>symbol</span><span class='rparen token'>)</span>
  <span class='symbol identifier id'>symbol</span><span class='dot token'>.</span><span class='match identifier id'>match</span><span class='lparen token'>(</span><span class='regexp val'>/^(name)_([a-z]{3})(_before_type_cast)?(=?)$/</span><span class='rparen token'>)</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="name-instance_method">
  
    - (<tt>Object</tt>) <strong>name</strong>(lang = nil) 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


67</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/option.rb', line 67</span>

<span class='def def kw'>def</span> <span class='name identifier id'>name</span><span class='lparen token'>(</span><span class='lang identifier id'>lang</span> <span class='assign token'>=</span> <span class='nil nil kw'>nil</span><span class='rparen token'>)</span> <span class='translation_for identifier id'>translation_for</span><span class='lparen token'>(</span><span class='symbol val'>:name</span><span class='comma token'>,</span> <span class='lang identifier id'>lang</span><span class='rparen token'>)</span> <span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="name=-instance_method">
  
    - (<tt>Object</tt>) <strong>name=</strong>(lang, value) 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


68</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/option.rb', line 68</span>

<span class='def def kw'>def</span> <span class='name= identifier id'>name=</span><span class='lparen token'>(</span><span class='lang identifier id'>lang</span><span class='comma token'>,</span> <span class='value identifier id'>value</span><span class='rparen token'>)</span> <span class='set_translation_for identifier id'>set_translation_for</span><span class='lparen token'>(</span><span class='symbol val'>:name</span><span class='comma token'>,</span> <span class='lang identifier id'>lang</span><span class='comma token'>,</span> <span class='value identifier id'>value</span><span class='rparen token'>)</span> <span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="published?-instance_method">
  
    - (<tt>Boolean</tt>) <strong>published?</strong> 
  

  
</p><div class="docstring">
  <div class="discussion">
    

  </div>
</div>
<div class="tags">
  
<h3>Returns:</h3>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Boolean</tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


70</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/option.rb', line 70</span>

<span class='def def kw'>def</span> <span class='published? fid id'>published?</span><span class='semicolon token'>;</span> <span class='notop op'>!</span><span class='option_sets identifier id'>option_sets</span><span class='dot token'>.</span><span class='detect identifier id'>detect</span><span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='os identifier id'>os</span><span class='bitor op'>|</span> <span class='os identifier id'>os</span><span class='dot token'>.</span><span class='published? fid id'>published?</span><span class='rbrace token'>}</span><span class='dot token'>.</span><span class='nil? fid id'>nil?</span> <span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="questions-instance_method">
  
    - (<tt>Object</tt>) <strong>questions</strong> 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


72</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/option.rb', line 72</span>

<span class='def def kw'>def</span> <span class='questions identifier id'>questions</span><span class='semicolon token'>;</span> <span class='option_sets identifier id'>option_sets</span><span class='dot token'>.</span><span class='collect identifier id'>collect</span><span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='os identifier id'>os</span><span class='bitor op'>|</span> <span class='os identifier id'>os</span><span class='dot token'>.</span><span class='questions identifier id'>questions</span><span class='rbrace token'>}</span><span class='dot token'>.</span><span class='flatten identifier id'>flatten</span><span class='dot token'>.</span><span class='uniq identifier id'>uniq</span> <span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="respond_to?-instance_method">
  
    - (<tt>Boolean</tt>) <strong>respond_to?</strong>(symbol, *) 
  

  
</p><div class="docstring">
  <div class="discussion">
    

  </div>
</div>
<div class="tags">
  
<h3>Returns:</h3>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Boolean</tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


53
54
55</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/option.rb', line 53</span>

<span class='def def kw'>def</span> <span class='respond_to? fid id'>respond_to?</span><span class='lparen token'>(</span><span class='symbol identifier id'>symbol</span><span class='comma token'>,</span> <span class='mult op'>*</span><span class='rparen token'>)</span>
  <span class='is_translation_method? fid id'>is_translation_method?</span><span class='lparen token'>(</span><span class='symbol identifier id'>symbol</span><span class='dot token'>.</span><span class='to_s identifier id'>to_s</span><span class='rparen token'>)</span> <span class='orop op'>||</span> <span class='super super kw'>super</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="respond_to_missing?-instance_method">
  
    - (<tt>Boolean</tt>) <strong>respond_to_missing?</strong>(symbol, include_private) 
  

  
</p><div class="docstring">
  <div class="discussion">
    

  </div>
</div>
<div class="tags">
  
<h3>Returns:</h3>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Boolean</tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


56
57
58</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/option.rb', line 56</span>

<span class='def def kw'>def</span> <span class='respond_to_missing? fid id'>respond_to_missing?</span><span class='lparen token'>(</span><span class='symbol identifier id'>symbol</span><span class='comma token'>,</span> <span class='include_private identifier id'>include_private</span><span class='rparen token'>)</span>
  <span class='is_translation_method? fid id'>is_translation_method?</span><span class='lparen token'>(</span><span class='symbol identifier id'>symbol</span><span class='dot token'>.</span><span class='to_s identifier id'>to_s</span><span class='rparen token'>)</span> <span class='orop op'>||</span> <span class='super super kw'>super</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>
    
    <div id="footer">
  Generated on Thu Dec  8 13:43:20 2011 by 
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.7.3 (ruby-1.8.7).
</div>

  </body>
</html>